/*    */ package com.zimbra.cs.milter;
/*    */ 
/*    */ import org.apache.mina.core.buffer.IoBuffer;
/*    */ import org.apache.mina.core.session.IoSession;
/*    */ import org.apache.mina.filter.codec.ProtocolEncoderAdapter;
/*    */ import org.apache.mina.filter.codec.ProtocolEncoderOutput;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ final class NioMilterEncoder
/*    */   extends ProtocolEncoderAdapter
/*    */ {
/*    */   public void encode(IoSession session, Object msg, ProtocolEncoderOutput out)
/*    */   {
/* 28 */     MilterPacket packet = (MilterPacket)msg;
/*    */     
/* 30 */     IoBuffer buffer = IoBuffer.allocate(4 + packet.getLength(), false);
/* 31 */     buffer.setAutoExpand(true);
/* 32 */     buffer.putInt(packet.getLength());
/* 33 */     buffer.put(packet.getCommand());
/* 34 */     byte[] data = packet.getData();
/* 35 */     if ((data != null) && (data.length > 0)) {
/* 36 */       buffer.put(data);
/*    */     }
/* 38 */     buffer.flip();
/* 39 */     out.write(buffer);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/milter/NioMilterEncoder.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */